package mylibrary.httpclient.v4;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.StringReader;
import java.util.Properties;

import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.HttpClients;

import com.sun.org.apache.xml.internal.security.utils.Base64;

public class Test {

	public static void main(String[] args) throws Exception {
		
//		HttpClient client = HttpClients.createDefault();
//		
//		HttpGet httpGet = new HttpGet("http://www.163.com");
//		HttpResponse response = client.execute(httpGet);
//		
//		System.out.println(response.toString());
		
		Properties properties = new Properties();
		
		//HttpResponse localHttpResponse = new DefaultHttpClient().execute(new HttpGet("http://fortify.luxoft.com/AndroidServer/getcommand"));
		HttpResponse localHttpResponse = new DefaultHttpClient().execute(new HttpGet("http://localhost:8070/sample/"));
		StatusLine localStatusLine = localHttpResponse.getStatusLine();
		if (localStatusLine.getStatusCode() == 200)
	    {
	      ByteArrayOutputStream localByteArrayOutputStream = new ByteArrayOutputStream();
	      localHttpResponse.getEntity().writeTo(localByteArrayOutputStream);
	      localByteArrayOutputStream.close();
	      String str = localByteArrayOutputStream.toString();
	      properties.load(new StringReader(str));
	      System.out.println(properties);
	      System.out.println(properties.getProperty("log"));
	      
	      
	      
	      //new StringBuilder(Base64.encodeToString(FlagService.getFlag(3, Aэепсгркнзд.calc()).getBytes(), 0)).reverse().toString();
	      return;
	    }
		
		//return (this.properties != null) && ("true".equals(this.properties.getProperty("log")));
		
	}
}
